<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.zclip.min.js"></script>
<script type="text/javascript" src="js/page.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/show_pic.js"></script>
<title>友着</title>
</head>
<body onLoad="remove()">
	<jsp:include page="navigation.jsp"></jsp:include>
	<div class="container" style="margin-left: 190px;">
		<div class="topbar-inner">
			<div class="myhead">
				<span class="crumb-name">${ user_name }的动态</span>
			</div>
		</div>
		<div class="topbar-inner">
				<div class="search">
					<button type="button" id="search_btn" onclick="goback(${ userid })"
						class="btn btn-default"
						style="margin-left: 20px; margin-top: 1px;">返回</button>
				</div>
			</div>
		<form id="pageForm" action="usermomentinfo" method="post">
		<input type="hidden" value="${ userid }" name="userid" />
			<input type="hidden" value="${ page.pageCount }" id="pageCount"
				name="pageCount" /> <input type="hidden"
				value="${ page.pageIndex }" id="pageIndex" name="pageIndex" />
		</form>
		<div style="margin: 20px 20px 20px 20px; text-align: center;">
			<table class="table table-bordered table-hover table-striped">
				<thead>
					<tr>
						<th>发布内容</th>
						<th>发布图片/视频</th>
						<th>发布时间</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${ list }" var="l">
						<tr>
							<td><c:if test="${fn:length(l.content) > 25}">${fn:substring(l.content, 0, 23)}...</c:if>
								<c:if test="${fn:length(l.content) <= 25}">${ l.content }</c:if>
							</td>
							<td><c:if test="${ l.video != null && l.video != '' }">
										<div class="input-group">
										<input type="text" class="form-control"
											value="http://139.196.188.251:8080/upload/${ l.video }" />
										<img class="copy_img" src="images/copy.png"
											style="border-top: 1px solid #CCC; border-bottom: 1px solid #CCC; border-right: 1px solid #CCC; border-top-right-radius: 5px; border-bottom-right-radius: 5px;"
											width="34px" height="34px" data-toggle="poppver"
											title="点击复制" data-placement="top"
											data-content="点击复制" />
									</div>
									</c:if> <c:if test="${ l.video == null || l.video == '' }">
									<c:if test="${ l.pics != null && l.pics != '' }">
									<c:set var="pics" value="${fn:split(l.pics, ',') }" />
									<c:forEach items="${ pics }" var="p">
										<img src="http://139.196.188.251:8080/upload/origin/${ p }"
											width="50px" height="50px" />
									</c:forEach>
									</c:if>
								</c:if></td>
							<td><fmt:formatDate value="${ l.create_time }"
									pattern="yyyy-MM-dd HH:mm:ss" type="date" dateStyle="long" /></td>
							<td><c:if test="${ l.status == 1 }">
								已警告
								</c:if> <c:if test="${ l.status == 2 }">
								已删除
								</c:if> <c:if test="${ l.status == 0 }">
									<a href="javascript:" onclick="toWarn(${ l.id })">警告</a>
								&emsp;|&emsp; <a href="javascript:"
										onclick="toDelete(${ l.id })">删除</a>
								</c:if></td>
						</tr>
					</c:forEach>

				</tbody>
			</table>
			<input type="hidden" value="${ page.pageCount }" id="pageCount"
				name="pageCount" /> <input type="hidden"
				value="${ page.pageIndex }" id="pageIndex" name="pageIndex" />
			<c:if test="${ page == null }">
				<div style="font-size: larger;">暂无数据</div>
			</c:if>
			<c:if test="${ page != null && page.pageCount > 1 }">
				<ul id="pagination" class="pagination">

				</ul>
				<script type="text/javascript">
					setPage(document.getElementById("pagination"), parseInt($(
							"#pageCount").val()), parseInt($("#pageIndex")
							.val()));
				</script>
			</c:if>
		</div>
	</div>
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel"
		aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close"
						data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">提示信息：</h4>
				</div>
				<div class="modal-body">
					<form id="modalForm" action="/promptmessage"
						method="post">
						<input type="hidden" id="prompt_type"
							class="form-control" name="prompt_type" /> <input
							type="hidden" id="id" class="form-control" name="id" />
						<div id="user_name_id"
							style="width: 100%; height: height: auto;">
							<textarea name="prompt_message"
								style="margin: 0 31px; width: 500px; height: 300px; border-radius: 8px; border: 1px solid; resize: none; outline: none;"
								id="prompt_message"
								onblur="if (value == '') {value = '请输入提示信息！'}"
								onfocus="if (value == '请输入提示信息！') { value = '' }">请输入提示信息！</textarea>
						</div>
						<div class="modal-footer"
							style="border-top: 0px solid #e5e5e5">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">关闭</button>
							<button type="button" class="btn btn-primary"
								id="sub_btn" onclick="toPrompt()">提交</button>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- /.modal -->
	
	<div id="moveimg" onMouseOver="dragimages=moveimg;drag=1;"
		class="show_big"
		style="z-index: 10000; position: absolute; left: 500px; top: 200px; display: none; onblur="$('#moveimg').hide();">
		<img src="" onmousewheel="return bbimg(this);" width="500px"
			height="500px" border="0" name="img1" />
	</div>

	<script>
		$(function() {
			$('.submenu_6_1').addClass('submenu_native');

			$('td>img').click(function() {
				$('.show_big>img').prop('src', $(this).prop('src'));
				$('.show_big').css('display', 'block');
				$('.show_big').focus();
			});
			$('.show_big').focus(function() {
				alert('asdfasdfadsf');
				$(this).css('display', 'none');
			});
			$('.show_big').blur(function() {
				alert('asdfasdfadsf');
				$(this).css('display', 'none');
			});
			$('.copy_img').click(function() {
				toCopyBlank($(this).parent().find('input').val());
				$('.copy_img').prop('title', '点击复制');
				$(this).prop('title', '已复制');
			});
			
			$('[data-toggle=popover]').popover();

		});
		
		function toWarn(id) {
			$("#myModal").modal('show');
			$('#prompt_type').val(1);
			$('#id').val(id);
		}
		function toDelete(id) {
			$("#myModal").modal('show');
			$('#prompt_type').val(2);
			$('#id').val(id);
		}
		function toPrompt() {
			var prompt_message = $('#prompt_message').val();
			if (prompt_message != null && prompt_message) {
				$.ajax({
					type: 'post', 
					url: 'promptmessage', 
					data: $('#modalForm').serialize(), 
					success: function(data) {
						if (data.code == 0) {
							alert('操作成功！');
							window.location.reload();
						} else {
							alert('操作失败！');
							window.location.reload();
						}
					}
				});
			} else {
				alert('提示信息不能为空！');
			}
		}
		
		function toCopyBlank(txt) {
			if (window.clipboardData ) {  
	            $('.copy_img').click(function() {  
	                window.clipboardData.setData("Text", txt);  
	                alert('复制成功！');  
	            });  
	        } else {  
	            $(".copy_img").zclip({  
	                path:'http://img3.job1001.com/js/ZeroClipboard/ZeroClipboard.swf',  
	                copy:function(){return txt},  
	                afterCopy:function(){alert('复制成功！');}  
	            });  
	        }
		}
		
		function goback(userid) {
			window.location.href = 'userdetail?userid=' + userid;
		}
	</script>
</body>

</html>